package com.myworkbench.workbench.domain.entity.resource;

import com.myworkbench.workbench.domain.entity.role.Role;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;


public  interface  ResourceRepository extends  JpaRepository<Resource,Integer>{

      @Query("select max(r.indexNo) from Resource r  where  r.isDelete =:isDelete")
       Integer  findMaxIndexNo(@Param("isDelete") Short isDelete);

     List<Resource> findByParentIdAndIndexNoLessThan(ResourceId parent, int indexNo);
}
